//
//  MoreCollectionViewController.m
//  yingshop
//
//  Created by hsy on 2017/4/13.
//  Copyright © 2017年 hubery. All rights reserved.
//


#import "MoreCollectionViewController.h"
#import "MoreCollectionViewCell.h"

@interface MoreCollectionViewController ()

@end

@implementation MoreCollectionViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setUpCollection];
    // Do any additional setup after loading the view, typically from a nib.
}

-(void)setUpCollection{
    self.dataMArr = [NSMutableArray array];
    UIImage *image = [UIImage imageNamed:@"ying_wifi_icon"];
    NSString *title =@"盈WiFi";
    NSDictionary *dic = @{@"image": image, @"title":title};
    [self.dataMArr addObject:dic];
    
    
    UIImage *ordet_image = [UIImage imageNamed:@"ying_order_icon"];
    NSString *ordet_txt =@"盈訂餐";
    NSDictionary *ordet_dic = @{@"image": ordet_image, @"title":ordet_txt};
    [self.dataMArr addObject:ordet_dic];
    
    UIImage *dr_image = [UIImage imageNamed:@"ying_dr_icon"];
    NSString *dr_txt =@"盈訂餐";
    NSDictionary *dr_dic = @{@"image": dr_image, @"title":dr_txt};
    [self.dataMArr addObject:dr_dic];
    
    UIImage *plus_image = [UIImage imageNamed:@"ying_plus_icon"];
    NSString *plus_txt =@"盈Plus";
    NSDictionary *plus_dic = @{@"image": plus_image, @"title":plus_txt};
    [self.dataMArr addObject:plus_dic];
    
    
    
    self.mMoreCollectionView.delegate = self;
    self.mMoreCollectionView.dataSource = self;
    
    
}

#pragma mark - Collection View Data Source
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    return self.dataMArr.count;
}



-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    
    static NSString *collectionCellID = @"moreCollectionCell";
    
    MoreCollectionViewCell *cell = (MoreCollectionViewCell *)[collectionView dequeueReusableCellWithReuseIdentifier:collectionCellID forIndexPath:indexPath];
    
    NSDictionary *dic    = self.dataMArr[indexPath.row];
    UIImage *image       = dic[@"image"];
    NSString *title      = dic[@"title"];
//
    cell.cellImage.image = image;
    cell.cellLabel.text = title;
    

    
    return cell;
};


@end
